require('./PageProgresstrack.styl');

const reactMixin = require('react-mixin');
const Actions = require('./actions');
const Store = require('./store');
import Maintainhighchart from 'components/maintainhighchart'
import Timerange from 'components/timerange'
import { Control } from 'react-keeper'
const ui = require('clientConfig/util/jsapi/ui');
class Progresstrack extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
        };
    }
    chnangeEvent(startTime, endTime) {
        let module_type = Control.state.origin.split('/')[0];
        if (module_type == 'payment') {
            Actions.fetch({ startTime: startTime, endTime: endTime, module_type, proj_category: 'payplan' })
        } else {
            if (module_type == "workplan") {
                Actions.fetch({ startTime: startTime, endTime: endTime, module_type, proj_category: 'software' })
            } else if (module_type == "tender"){
                Actions.fetch({ startTime: startTime, endTime: endTime, module_type, proj_category: 'tenderplan' })
            }
        }

    }

    render() {
        var data = {
            series: [{
                color: "#16B3F4",
                data: this.state.paypointerStrack
            }],
            categories: this.state.categories,
            show: false,
            percentage: true
        }
        return (
            <div className="progresstrack1">
                <Timerange onchange={this.chnangeEvent.bind(this)} />
                <Maintainhighchart data={data} />
            </div>
        );
    }

    componentWillMount() {
        ui.setTitle({ title: "进度总览" });
    }

    componentDidMount() {
    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}

reactMixin.onClass(Progresstrack, Reflux.connect(Store));

module.exports = Progresstrack;
